package com.sohu.tv.userbonus.service.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName SpringSimpleJob
 * @Description 业务执行
 * @Author zhuchen216628
 * @Date 2019/1/17 14:29
 * @Version 1.0
 **/
public class SpringSimpleJob implements SimpleJob {

    @Override
    public void execute(final ShardingContext shardingContext) {
        System.out.println(String.format("es-job execute Item: %s | Time: %s | Thread: %s | %s | %s",
                shardingContext.getShardingItem(),
                new SimpleDateFormat("HH:mm:ss").format(new Date()),
                Thread.currentThread().getId(), "SIMPLE",shardingContext.getShardingParameter()));
//        List<Foo> data = fooRepository.findTodoData(shardingContext.getShardingParameter(), 10);
//        for (Foo each : data) {
//            fooRepository.setCompleted(each.getId());
//        }
    }
}